package com.hopes.bizz.close.gis.vo;

import com.hopes.bizz.close.basic.entity.ClosedAccessControlEntity;
import com.hopes.bizz.close.basic.entity.ClosedGateEntity;
import com.hopes.bizz.close.common.constant.CloseModuleEnums;
import com.hopes.bizz.close.common.constant.enums.ParkCloseSysDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.AdminDictEnum;
import lombok.Data;

import java.io.Serializable;

/**
 * @author yumr
 * @ProjectName bizz
 * @Description 卡口门禁图层VO
 * @time 2024/2/25 10:03
 */
@Data
public class GateAccessLayerVO implements Serializable {

    private static final long serialVersionUID = 7202285415637538609L;

    private Long id;

    /**
     * 卡口、门禁
     */
    private String type;

    /**
     * 名称
     */
    private String name;

    /**
     * 分类
     */
    private String classify;


    /**
     * 位置信息
     */
    private String position;

    /**
     * 网络状态
     */
    private String networkStatus;

    /**
     * 所属企业
     */
    private Long orgId;


    public GateAccessLayerVO(String type, ClosedGateEntity gateEntity) {
        this.type = type;
        this.id = gateEntity.getId();
        this.name = gateEntity.getName();
        this.classify = gateEntity.getGateClassify();
        this.position = gateEntity.getGateLocation();
        this.networkStatus = gateEntity.getNetworkStatus();
        if (type.equals(CloseModuleEnums.GateAccessTypeEnum.access.name())) {
            this.orgId = gateEntity.getOrgId();
        }
    }

    public GateAccessLayerVO(String type, ClosedAccessControlEntity accessControl) {
        this.type = type;
        this.id = accessControl.getId();
        this.name = accessControl.getName();
        this.classify = accessControl.getAccessClassify();
        this.position = accessControl.getAccessLocation();
        this.networkStatus = accessControl.getNetworkStatus();
        if (type.equals(CloseModuleEnums.GateAccessTypeEnum.access.name())) {
            this.orgId = accessControl.getOrgId();
        }
    }

    public String getOrgIdStr() {
        return DictResolver.getItemLabelByValue(AdminDictEnum.sys_company, this.getOrgId());
    }

    public String getClassifyStr() {
        return DictResolver.getItemLabelByValue(ParkCloseSysDictEnum.close_gate_access_classify, this.getClassify());
    }

    public String getNetworkStatusStr() {
        return DictResolver.getItemLabelByValue(ParkCloseSysDictEnum.close_device_network_status, this.getNetworkStatus());
    }

}
